using UnityEngine;
using UnityEngine.EventSystems;

public class MyButton : MonoBehaviour, IPointerDownHandler, IPointerUpHandler
{
    AudioSource audioSource;
    private void Awake()
    {
        audioSource = gameObject.AddComponent<AudioSource>();
        audioSource.clip = Resources.Load<AudioClip>("Button2");
    }

    public void OnPointerDown(PointerEventData eventData)
    {
        transform.localScale *= 1.1f;
        if(GameManager.useAudio)
        {
            audioSource.time = 0.025f;
            audioSource.Play();
        }
    }

    public void OnPointerUp(PointerEventData eventData)
    {
        transform.localScale /= 1.1f;
    }
}
